package com.itheima.exerciseTest.method10_19.method11;

import java.util.TreeSet;

/*
    分别用Comparable和Comparator两个接口对下列四位同学的成绩做降序排序，
    如果成绩一样，那在成绩排序的基础上按照年龄由小到大排序。
    姓名（String）	年龄（int）	分数（float）
    liusan	        20	        90.0F
    lisi		    22	        90.0F
    wangwu		    20	        99.0F
    sunliu		    22	        100.0F
 */
public class ComparableTest {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<>();
        Student s1 = new Student("liusan", 20, 99.0F);
        Student s2 = new Student("lisi", 22, 90.0F);
        Student s3 = new Student("wangwu", 20, 99.0F);
        Student s4 = new Student("sunliu", 22, 100.0F);
        Student s5 = new Student("张三", 22, 90.0F);
        Student s6 = new Student("李四", 22, 90.0F);
        Student s7 = new Student("王五", 22, 100.0F);
        Student s8 = new Student("李四", 22, 100.0F);
        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        ts.add(s5);
        ts.add(s6);
        ts.add(s7);
        ts.add(s8);
        for (Student stu : ts) {
            System.out.println(stu);
        }
    }
}
